package com.choudou5.solr.framework.constants;

/**
 * @name 系统常量
 * @author choudou5
 * @date 2018-7-13
 */
public interface SysConsts {

    String UTF8 = "UTF-8";

    String STATUS_Y = "1";
    String STATUS_N = "0";

    String HEADER_TOKEN = "x-token";

    String PAGE_ROOT = "/WEB-INF/view/";
    String PAGE_LOGIN = "login";
    String PAGE_INDEX = "index";
    /** 管理控制请求前缀 */
    String PAGE_ADMIN_CONSOLE_PREFIX = "/adminConsole";
    String[] STATIC_PATH = new String[]{"/page/login", "/adminConsole/login", "/adminConsole/system/lastNotice", "/assets", "/ui-template", "/pub/", "/favicon.ico", "/page/login", "/page/error", "/api"};

    enum ActionType {

        LOGIN("login", "登录了"),
        LOGIN_OUT("loginOut", "退出了"),
        ADD("add", "新增了"),
        DEL("del", "删除了"),
        UPDATE("update", "修改了"),
        VIEW("view", "查看了"),
        ;

        ActionType(String key, String desc) {
            this.key = key;
            this.desc = desc;
        }

        private String key;
        private String desc;

        public static ActionType get(String key){
            ActionType[] values = values();
            for (ActionType type : values) {
                if(type.getKey().equals(key)) {
                   return type;
                }
            }
            return null;
        }

        public String getKey() {
            return key;
        }
        public String getDesc() {
            return desc;
        }
    }

}
